#include "NetworkClient.h"

#include <iostream>

NetworkClient::NetworkClient(char *serverName, int portNumber){
	if( SDLNet_ResolveHost(&ip, serverName, portNumber)==-1 ){exit(1);}
	
	pthread_mutex_lock( &connectionLock );
	
	if(numConnections < MAXCOMS){
		connections[numConnections] = SDLNet_TCP_Open(&ip);
		if(!(connections[numConnections])){exit(1);}
		addInputHandler(numConnections);
		numConnections++;
	}
	
	pthread_mutex_unlock( &connectionLock );
	
	std::cout << "Making Client\n";
}

NetworkClient::~NetworkClient(){

}

